﻿@{
    ViewBag.Title = "客户PDA权限修改";
    int pageIndex = TempData["pageIndex"] == null ? 1 : (int)TempData["pageIndex"];
    Searcher searcher = TempData["searcher"] as Searcher;
    var roleid = SessionHelper.CurrUser.RoleID;
}
@Styles.Render("~/Content/list")
<style type="text/css">
    #divSearch
    {
        width: 75%;
        float: left;
    }
    #divSearch input
    {
        width: 100px;
    }
</style>
<div id="adsearch">
    @using (Ajax.BeginForm("Grid", new { r = new Random().NextDouble() }, new AjaxOptions { UpdateTargetId = "gridview", LoadingElementId = "loading" })) {
            <table class="searchbar">
                <tr>
                 @if (roleid == Constant.Admin)
                    {
                    <th>
                        代理商:
                    </th>
                    <td>
                        @Html.DropDownList("ad.CreateUsersID", new DropDownList(DropDownListType.Agency), "--请选择--")
                    </td>
                    }
                    @if (roleid == Constant.Admin)
                    {
                    <th>
                        客户:
                    </th>
                    <td>
                        @Html.DropDownList("ad.UsersID", new DropDownList(DropDownListType.Empty))
                    </td>
                    }
                    else if (roleid == Constant.Agency)
                    {
                        <th>
                        客户:
                    </th>
                    <td>
                        @Html.DropDownList("ad.UsersID", new DropDownList(DropDownListType.Account), "--请选择--")
                    </td>
                    }
                </tr>
            </table>
        <p>
            <input class="button" type="submit" name="submit" value="查询" />
        </p>
    }
</div>
<div id="loading" class="loading">
    <img src="@Url.Content("~/Images/icon-loader.gif")" alt="Searching" />
</div>
<div id="gridview">
    @{ Html.RenderAction("Grid", new { pageIndex = pageIndex, searcher = searcher });}
</div>
@section scripts{
    @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/bundles/cascade")

    <script type="text/javascript">
        $(function ()
        {
            $("#ad_CreateUsersID").cascade({
                source: '@Url.Action("GetAccount", "Account")',
                cascaded: 'ad_UsersID',
                disableUntilLoaded: true
            });
        }); 
    </script>
}
